<template>
	<view class="content">
		<!-- <u-navbar title="会员团购券" :placeholder='true' height="88rpx" leftIconColor="#fff" -->
		<u-navbar title="卡券发送记录" :placeholder='true' height="88rpx" leftIconColor="#fff"
			titleStyle='color:#fff;font-size:32rpx' left-icon-size="32rpx" bg-color="#FF594D" :autoBack="true">
		</u-navbar>
		<view class="coupon_list">
			<template v-for="(item,index) in recordList">
				<view class="discount_coupon">
					<view class="discount_left">
						<!-- 				<view class="vip">
							会员专享
						</view> -->
						<view class="discount_money" v-if="item.discountType==3  || item.verificationCode!=null">
							<text>商品券</text>
						</view>
						<view class="discount_money" v-else>
							<text>￥</text>{{ item.maxDiscountAmount}}
						</view>
						<view class="condition" v-if="item.discountType!=3 && item.verificationCode==null">
							{{item.thresholdAmount ==0?'无门槛':`满${item.thresholdAmount}元可用`}}
						</view>
					</view>
					<view class="discount_line">

					</view>
					<view class="discount_right">
						<view class="discount_name">
							<text>{{item.name}}</text>
						</view>
						<view class="time">
							{{item.updateTime}}
						</view>
					</view>
				</view>
			</template>
		</view>
	</view>
</template>

<script>
	import {
		cuponsList
	} from '../../../api/employee.js'
	export default {
		data() {
			return {
				recordList: []
			}
		},
		created() {
			this.getCuponsList()
		},
		methods: {
			async getCuponsList() {
				const res = await cuponsList()
				// console.log(res);
				if (res.code !== 200) {
					uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					return
				}
				this.recordList = res.data
			}
		}
	}
</script>

<style lang="scss">
	.content {
		min-height: 100vh;
		background-color: #F3F3F3;
	}

	.coupon_list {
		padding: 20rpx;
	}

	.discount_coupon {
		width: 694rpx;
		height: 196rpx;
		background: #FDF5F6;
		border-radius: 10rpx;
		overflow: hidden;
		position: relative;
		display: flex;

		.vip {
			width: 130rpx;
			height: 36rpx;
			background: #FDF5F6;
			font-size: 20rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			line-height: 36rpx;
			color: #FD3653;
			text-align: center;
			position: absolute;
			left: 0;
			top: 0;
			background-image: linear-gradient(to right, #FDD59F, #fdefe7);
		}

		.discount_left {
			padding: 50rpx 0 0;
			color: #FD3653;
			box-sizing: border-box;
			width: 200rpx;
			text-align: center;

			.discount_money {
				font-size: 55rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				color: #FD3653;

				text {
					font-size: 28rpx;

				}
			}

			.condition {
				font-size: 24rpx;
				font-weight: 400;
				padding-top: 16rpx;
				color: #FD3653;
			}
		}

		.discount_line {
			width: 0rpx;
			margin-top: 30rpx;
			height: 136rpx;
			border-left: 1rpx dotted #F9A5B1;
		}

		.discount_right {
			padding: 36rpx 0 0 40rpx;

			.discount_name {
				display: flex;

				text {
					width: 236rpx;
					height: 86rpx;
					font-size: 32rpx;
					overflow: hidden;
					font-weight: bold;
					text-overflow: ellipsis;
					color: #222222;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
				}

				.get_discount {
					width: 160rpx;
					height: 44rpx;
					background: #FF594D;
					border-radius: 58rpx 58rpx 58rpx 58rpx;
					font-size: 20rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
					text-align: center;
					line-height: 44rpx;
					margin-top: 40rpx;
					margin-left: 30rpx;

					&.use {
						box-sizing: border-box;
						border: 2rpx solid #FF594D;
						color: #FF594D;
						background-color: transparent;
					}
				}
			}

			.time {
				font-size: 20rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				color: #666666;
				padding-top: 9rpx;
			}
		}
	}
</style>